{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_tcwq/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li class="active"><a href="{php echo $this->createWebUrl('inzx')}">资讯管理</a></li>
    <li><a href="{php echo $this->createWebUrl('inaddzx')}">添加资讯</a></li>
</ul>
<div class="row ygrow">
    <div class="col-lg-12">
        <form action="" method="get" class="col-md-4">
        <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="inzx" />
            <div class="input-group" style="width: 300px">
                <input type="text" name="keywords" class="form-control" placeholder="请输入标题">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </form>
         <form action="" method="get" class="col-md-4">
         <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="inzx" />
            <div class="input-group" style="width: 100px">
                {php echo tpl_form_field_daterange('time');}
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit2" value="查找"/>
                     <input type="hidden" name="token" value="{$_W['token']}"/>
                </span>
            </div><!-- /input-group -->
        </form>
        <div class="col-md-4">

            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div> 
<div class="main">
    <div class="panel panel-default">
        <div class="panel-heading">
            资讯管理
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <th class="store_td1 col-md-1" style="text-align: center;">
                            <input type="checkbox" class="allcheck" />
                            <span class="store_inp">全选</span>                      
                          </th>
                      <th class="col-md-2">发布时间</th>
                        <th class="col-md-2">所属分类</th>
                        <th class="col-md-2 store_td1">资讯标题</th>                      
                       <th class="col-md-1">发布人</th>
                     <th class="col-md-2">资讯内容</th>
                        <th class="col-md-2">操作</th>
                    </tr>
                    {loop $list $row}
                    <tr class="yg5_tr2">
                        <td>
                          <input type="checkbox" name="test" value="{$item['id']}">
                        </td>
                        <td>{$row['time']}</td>
                        <td>{$row['type_name']}</td>
                        <td><div class="type-parent">{$row['title']}&nbsp;&nbsp;</div></td>
                      
                        
                         <td>{php echo empty($row['wname'])?'平台发布':$row['wname']}</td>
                       <td>{$row['content']}</td>
                        <td>
                            <a href="{php echo $this->createWebUrl('inaddzx', array('id' => $row['id']))}" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                </span>                            
                            </a>
                            <!-- <a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('inaddzx', array('id' => $row['id']))}" title="编辑">改</a>&nbsp;&nbsp; -->
                            <!-- <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{$row['id']}">删</button></td> -->
                    </tr>
                    <div class="modal fade" id="myModal{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('inzx', array('op' => 'delete', 'id' => $row['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>           
                    {/loop}
                    {if empty($list)}
                    <tr class="yg5_tr2">
                        <td colspan="12">
                            暂无拼车信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </form>
    </div>
    
</div>
<div class="text-right we7-margin-top">
   {$pager}
</div>
<script type="text/javascript">
    $(function(){
        // ———————————————批量删除———————————————
        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的资讯!');
                return false;
            }else if(confirm("确认要删除此资讯?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       // location.reload();
                    }
                })               
            }
        });
        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
        $("#frame-3").show();
        $("#yframe-3").addClass("wyactive");
    })
</script>